package com.compress;

import java.io.File;

public class Assert {

	public static void assertNotNull(Object obj, String message) {
		if (obj == null) {
			throw new NullPointerException(message);
		}
	}

	public static void assertNotEqual(Object o1, Object o2, String message) {
		if ((o1 == null && o2 == null) || (o1.equals(o2))) {
			throw new IllegalArgumentException(message);
		}
	}

	public static void assertNotEmpty(String str, String message) {
		if (str == null || str.length() == 0) {
			throw new NullPointerException(message);
		}
	}

	public static void assertFileExist(File file, String message) {
		if (file == null || !file.exists()) {
			throw new IllegalArgumentException(message);
		}
	}

	public static void assertIsFile(File file, String message) {
		if (file.exists() && !file.isFile()) {
			throw new IllegalArgumentException(message);
		}
	}

	public static void assertIsDir(File file, String message) {
		if (file.exists() && !file.isDirectory()) {
			throw new IllegalArgumentException(message);
		}
	}
}
